<?php
/**
 * Created by @baidu-aip
 * Author: ylang
 * Time: 2022/2/24 12:28
 */

namespace Hedgehog\BaiduAip\Api;

use Hedgehog\BaiduAip\Api;


/**
 * 文字识别
 * @method  accurate_basic(string $image, array $option = [])
 * @method  accurate(string $image, array $option = [])
 * @method  general_basic(string $image, array $option = [])
 * @method  general(string $image, array $option = [])
 * @method  doc_analysis_office(string $image, array $option = [])
 * @method  webimage(string $image, array $option = [])
 * @method  webimage_loc(string $image, array $option = [])
 * @method  form(string $image, array $option = [])
 * @method  seal(string $image, array $option = [])
 * @method  handwriting(string $image, array $option = [])
 * @method  numbers(string $image, array $option = [])
 * @method  qrcode(string $image, array $option = [])
 * @method  multiple_invoice(string $image, array $option = [])
 * @method  vat_invoice(string $image, array $option = [])
 */
class Orc extends Api
{

    protected array $funcUrl = [
        'accurate_basic' => 'ocr/v1/accurate_basic',
        'accurate' => 'ocr/v1/accurate',
        'general_basic' => 'ocr/v1/general_basic',
        'general' => 'ocr/v1/general',
        'doc_analysis_office' => 'ocr/v1/doc_analysis_office',
        'webimage' => 'ocr/v1/webimage',
        'webimage_loc' => 'ocr/v1/webimage_loc',
        'form' => 'ocr/v1/form',
        'seal' => 'ocr/v1/seal',
        'handwriting' => 'ocr/v1/handwriting',
        'numbers' => 'ocr/v1/numbers',
        'qrcode' => 'ocr/v1/qrcode',

        'multiple_invoice' => 'ocr/v1/multiple_invoice',
        'vat_invoice' => 'ocr/v1/vat_invoice',
    ];


    public function __call($name, $arguments)
    {
        return $this->parseJson($this->funcUrl[$name], array_merge([
            'image' => base64_encode($arguments[0]),
        ], $arguments[1] ?? []));
    }

}